<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 100px;
      height: 100px;
      background-color: #f66;
    }
  </style>
</head>
<body>
  <div id="app">
    <div class="box" @click="clickDiv">
      <button @click="clickBtn">点我</button>
    </div>
    <!-- 如何阻止冒泡
    基于事件对象
    可以给子元素添加.stop
    或者给父元素添加 .self
    -->
    <div class="box" @click="clickDiv1">
      <button @click.stop="clickBtn1">点我1</button>
    </div>
  </div>
</body>
<script src="lib/vue.js"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      count: 100
    },
    methods: {
      clickBtn (e) {
        // e.cancelBubble = true
        e.stopPropagation();
        console.log('btn')
      },
      clickDiv (e) {
        console.log('div')
      },
      clickBtn1 (e) {
        console.log('btn')
      },
      clickDiv1 (e) {
        console.log('div')
      }
    }
  })
</script>
</html>